home *** CD-ROM | disk | FTP | other *** search
- /****i* SOURCE_FILE/INFO
- *
- * NAME
- * AlertInvalidField.js
- *
- * USAGE
- * Part of Netobjects JavaScript Library.
- *
- * COPYRIGHT
- * Copyright ⌐ 2002-2004 Website Pros, Inc.
- * All Rights Reserved.
- *
- * This is an unpublished work protected by Website Pros, Inc.
- * as a trade secret, and is not to be used or disclosed except as
- * expressly provided in a written license agreement executed by
- * you and Website Pros, Inc.
- *
- * <copyright@websitepros.com>
- *
- * NOTES
- * JavaScript code.
- *****/
-
- if (!IS_isModuleInitialized("IS.NOF.UTIL.AlertInvalidField"))
- {
- /****h* NOF_JavaScript_Library/NOF.UTIL.AlertInvalidField
- *
- * NAME
- * NOF.UTIL.AlertInvalidField
- *
- * DESCRIPTION
- *
- *
- * External dependencies:
- ****/
- /**
- * AlertInvalidField
- */
- function NOF_AlertInvalidField(_document, _alertTextContainer, _fields) {
- this.__proto__ = NOF_AlertInvalidField.prototype;
-
- this.doc = _document;
- this.alertTextContainer = _alertTextContainer;
- this.fields = _fields;
-
- this.classNormal = "formtext";
- this.classError = "errorformtext";
- this.imageNormal = "spacer.gif";
- this.imageError = "error_ph.gif";
- }
-
- function NOF_AlertInvalidField_ProtoBuilder() {
- var member = NOF_AlertInvalidField.prototype;
-
- member.notifyField = notifyField;
- member.notifyAllFields = notifyAllFields;
- member.alertTextContainer = null;
- member.classNormal = null;
- member.classError = null;
- member.imageNormal = null;
- member.imageError = null;
-
- function notifyField(field, condition, alertText) {
- //var result = !eval(f + '.value.length');
- var cls = (condition ? this.classError : this.classNormal);
- var img = (condition ? this.imageError : this.imageNormal);
- var t = field + 'Text';
- var i = field + 'Image';
- eval(t + '.className = "' + cls + '"');
- eval(i + '.src = "./images/' + img + '"');
-
- if (alertText == null)
- alertText = "";
- this.doc.setElementValue(this.alertTextContainer, alertText);
- }
-
- function notifyAllFields(condition) {
- //var result = !eval(f + '.value.length');
- var cls = (condition ? this.classError : this.classNormal);
- var img = (condition ? this.imageError : this.imageNormal);
-
- for (var i = 0; i < this.fields.length; i++) {
- var text = this.fields[i] + 'Text';
- var image = this.fields[i] + 'Image';
- eval(text + '.className = "' + cls + '"');
- eval(image + '.src = "./images/' + img + '"');
- }
- }
- }
-
-
- NOF_AlertInvalidField_ProtoBuilder();
- //NOF.__proto__.AlertInvalidField = NOF_AlertInvalidField;
- UTIL.__proto__.AlertInvalidField = NOF_AlertInvalidField;
- }